#!/bin/bash

tempfile=`mktemp -t testTempfile.XXXXXX`

exec 3>&1

exec 1>$tempfile

echo "script wirites to the temporary file : $tempfile"

echo "this is the first line"

echo "this is the second line"

exec 1>&3

exec 3>>$tempfile
#
echo "this is the end line of file " >& 3
#
echo "the script end , bye"
#
